package h0716;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringJoiner;
/**
  * @description 机场航班调度程序
  * @author 不知名帅哥
  * @date 2024/7/16 9:08
  * @version 1.0
*/
public class FlightDispatch {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        String[] flights = s.split(",");
        Arrays.sort(flights, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                String prefix1=o1.substring(0,2);
                String a=o1.substring(2);
                String prefix2=o2.substring(0,2);
                String b=o2.substring(2);
                if (!prefix1.equals(prefix2)){
                    return prefix1.compareTo(prefix2);
                }
                return a.compareTo(b);
            }
        });
        StringJoiner sj=new StringJoiner(",");
        for (String flight : flights) {
            sj.add(flight);
        }
        System.out.println(sj.toString());
    }
}
